import axios from 'axios'

const EMPLOYEE_BASE_REST_API_URL = "http://localhost:8090/api/v1/employees";

class EmployeesService{

    getAllEmployees(){
        return axios.get(EMPLOYEE_BASE_REST_API_URL)
    }

    createEmployee(employee){
        return axios.post(EMPLOYEE_BASE_REST_API_URL,employee)
    }

    getEmployeeById(employeeId){
        return axios.get(EMPLOYEE_BASE_REST_API_URL + "/" + employeeId)
    }

    updateEmployee(employeeId,employee){
        return axios.put(EMPLOYEE_BASE_REST_API_URL + "/" + employeeId,employee)

    }
    getEmployeeByEmployeeId(employeesId){
        return axios.get(EMPLOYEE_BASE_REST_API_URL + "/getByEmployee/" + employeesId)
    }

    deleteEmployee(employeeId){
        return axios.delete(EMPLOYEE_BASE_REST_API_URL + "/" + employeeId);
    }


}

export default new EmployeesService();